<#include "/common/layout_dl.html">
<@header>
</@header>
<@body>
<div class="row">
	<div class="col-md-12">
	<div class="nav-tabs-custom">
	     <ul class="nav nav-tabs">
	       <li class="active"><a href="#tab_1" data-toggle="tab">添加分类</a></li>
	       <li><a href="#tab_2" data-toggle="tab">添加一级字典</a></li>
	       <li><a href="#tab_3" data-toggle="tab">添加二级字典</a></li>
	     </ul>
	     <div class="tab-content">
	       <div class="tab-pane active" id="tab_1">
	        	 <div class="row">
	  	<div class="col-md-6">
		  <form role="form" class="layui-form layui-form-pane" method="post" action="${base}/system/dictionary/doAddCatgory">
		     <div class="box-body">
		       <div class="form-group">
		         <label for="uname">分类名</label>
		        	<input type="text" name="categoryNameChs" class="form-control" placeholder="请输入分类名eg:学历" lay-verify="required">
		       </div>
		       <div class="form-group">
		         <label for="uname">编码</label>
		        	<input type="text" name="categoryNameEn" class="form-control" placeholder="请输入编码eg:name"  lay-verify="required">
		       </div>
		       <div class="form-group">
		         <label for="uname">备注</label>
		        	<input type="text" name="remark" class="form-control" placeholder="请输入备注信息">
		       </div>
		       <div class="form-group">
			     <button type="submit" class="btn btn-success" lay-submit lay-filter="submit"><i class="fa fa-save"></i>  提 交</button>
			     <a  class="btn btn-default" href="javascript:parent.layer.closeAll('iframe');"><i class="fa fa-close"></i>  取消</a>
			   </div>
		     </div><!-- /.box-body -->
	 	</form>
		</div>
	</div>
	     </div><!-- /.tab-pane -->
	    <div class="tab-pane" id="tab_2">
	       <div class="row">
	<div class="col-md-6">
	<form role="form" class="layui-form layui-form-pane" method="post" action="${base}/system/dictionary/addDictionary">
	  <div class="box-body">
	       <div class="form-group">
	          <label>所属分类</label>
	          <select name="categoryId" class="form-control select2" style="width: 100%;" lay-verify="required" lay-ignore>
	      <#list list as m>
	      <option value="${(m.categoryId)!}">${(m.categoryNameChs)!}</option>
	      </#list>
	    </select>
	  </div><!-- /.form-group -->
	  <input type="hidden" name="parentId" value="0">
	  <input type="hidden" name="deep" value="1">
	   <div class="form-group">
	     <label for="uname">字典名称</label>
	    	<input type="text" name="dvalue" class="form-control" placeholder="请输入菜单名称" lay-verify="required">
	   </div>
	   <div class="form-group">
	     <label for="uname">描述</label>
	    	<input type="text" name="desc" class="form-control" placeholder="请输入描述信息"  lay-verify="required">
	   </div>
	   <div class="form-group">
	     <label for="uname">排序</label>
	    	<input type="text" name="sort" class="form-control" placeholder="请输入排序"  lay-verify="required|number">
	   </div>  
	    <div class="form-group">
	     <button type="submit" class="btn btn-success" lay-submit lay-filter="submit"><i class="fa fa-save"></i>  提 交</button>
	     <a  class="btn btn-default" href="javascript:parent.layer.closeAll('iframe');"><i class="fa fa-close"></i>  取消</a>
	   </div>
	</div><!-- /.box-body -->
	 </form>
		</div>
	</div>
	     </div><!-- /.tab-pane -->
	    
	     <div class="tab-pane" id="tab_3">
	     	 <div class="row">
	<div class="col-md-6">
	<form role="form" class="layui-form layui-form-pane" method="post" action="${base}/system/dictionary/addDictionary">
	  <div class="box-body">
	    <div class="form-group">
	         <label>所属分类/一级字典</label>
	         <select id="categoryId"  name="categoryId" class="form-control select2" style="width: 100%;" lay-verify="required" lay-ignore>
			     <option value="" selected="selected">--请选择--</option>
			     <#list list as m>
			      <option value="${(m.categoryId)!}">${(m.categoryNameChs)!}</option>
			      </#list>
			   </select>
	   <select id="parentId" name="parentId" class="form-control select2" style="width: 100%;" lay-verify="required" lay-ignore>
	         <option value="" selected="selected">--请选择--</option>
	     </select>
		</div>
		<input type="hidden" name="deep" value="2">
		<div class="form-group">
	     <label for="uname">字典名称</label>
	    	<input type="text" name="dvalue" class="form-control" placeholder="请输入字典名称" lay-verify="required">
	   </div>
	   <div class="form-group">
	     <label for="uname">描述</label>
	    	<input type="text" name="desc" class="form-control" placeholder="请输入描述"  lay-verify="required">
	   </div>
	   <div class="form-group">
	     <label for="uname">排序</label>
	    	<input type="text" name="sort" class="form-control" placeholder="请输入排序"  lay-verify="required|number">
	   </div>
	      <div class="form-group">
		     <button type="submit" class="btn btn-success" lay-submit lay-filter="submit"><i class="fa fa-save"></i>  提 交</button>
		     <a  class="btn btn-default" href="javascript:parent.layer.closeAll('iframe');"><i class="fa fa-close"></i>  取消</a>
		   </div>
	   </div><!-- /.box-body -->
	 </form>
		</div>
	</div>
	     </div><!-- /.tab-pane -->
	
	</div><!-- /.tab-pane -->
	</div><!-- /.tab-content -->
	</div><!-- nav-tabs-custom -->
	</div>
</@body>
<@footer>
<script>
$("#categoryId").on('change',function(){
	var categoryId = $(this).val();
	 $.post('${base}/system/dictionary/json?_dc='+new Date().getTime(),{categoryId:categoryId},function(response){
		if(response.code==200){
			$("#parentId").empty();
			$("#parentId").select2({
				data:response.data
			});
		}
	}); 
});
</script>
</@footer>